package com.jlnx.controller.bank;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jlnx.dao.ChainEnterpriseDaoImpl;
import com.jlnx.dao.CoreEnterpriseDaoImpl;
import com.jlnx.dao.EnterpriseDaoImpl;
import com.jlnx.dao.FinanceReqDaoImpl;
import com.jlnx.pojo.ChainEnterprise;
import com.jlnx.pojo.CoreEnterprise;
import com.jlnx.pojo.Enterprise;
import com.jlnx.pojo.FinanceReq;


@WebServlet("/AllEnterpriseSearchController")
public class AllEnterpriseSearchController extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		//获取请求信息
		response.setContentType("application/json;charset=UTF-8;text/html");
		//设置请求编码模式
    	request.setCharacterEncoding("utf-8");
				
		 //获取session对象
		 HttpSession hs=request.getSession();
		 //获取登录账号
		 String entNo = ((Enterprise)hs.getAttribute("enterprise")).getEntNo();
		 System.out.println( entNo + ":发起企业信息全查询请求");
		 CoreEnterpriseDaoImpl coredao = new CoreEnterpriseDaoImpl();
		 ChainEnterpriseDaoImpl chaindao = new ChainEnterpriseDaoImpl();

		 //查询全部核心企业
		 List<CoreEnterprise> listCore = coredao.selectCoreEnterpriseList();
		 //查询全部链条企业
		 List<ChainEnterprise> listChain = chaindao.selectChainEnterpriseList();
		System.out.println(listCore + ":" + listChain);
		//发送数据到页面
		request.setAttribute("coreEntList", listCore);
		request.setAttribute("chainEntList", listChain);
		//跳转界面
		request.getRequestDispatcher("/main/enterpriseSearch.jsp").forward(request, response);
				
	}

}
